package jmine.tec.datadigester.positional.checker.types;

import java.lang.reflect.Method;
import java.math.BigDecimal;

import jmine.tec.datadigester.positional.annotations.PositionalBigDecimalEntry;
import jmine.tec.datadigester.positional.checker.PositionalTypeChecker;
import jmine.tec.datadigester.positional.checker.PositionalTypeRange;

/**
 * @author israel.crisanto
 */
public class BigDecimalPositionalTypeChecker implements PositionalTypeChecker<PositionalBigDecimalEntry> {

    public boolean verifyIfMethodIsOk(Method method) {
        return !((method.getParameterTypes().length != 1) || (method.getParameterTypes()[0] != BigDecimal.class));
    }

    public PositionalTypeRange getRange(PositionalBigDecimalEntry annotation, Method method) {
        return new PositionalTypeRange(method, annotation.start(), annotation.size());
    }

}
